package com.shj.config.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description TODO 暂无权限处理类
 * @Author songhuajian
 * @Date 2020/3/12 23:49
 **/
@Component
public class UserAuthAccessDeniedHandler implements AccessDeniedHandler  {

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) throws IOException, ServletException {
        // 跳转无权限页面
        String url = "/jsp/401.jsp";
        request.getRequestDispatcher(url).forward(request, response);
    }
}
